const Router = require('koa-router')
const router = new Router({prefix: '/users'})
const {userValidator, verifyUser, bcryptPassword, verifyLogin} = require('../middleWare/user.middleware')
const {index, register, login, changePassword, checkInfo} = require('../controller/user.controller')
const {auth} = require('../middleWare/auth.middleware')
router.get('/', index)
router.post('/getInfo', auth, checkInfo)
router.post('/userRegister', userValidator, verifyUser, bcryptPassword, register)
router.post('/login', verifyLogin, login)
router.patch('/changeInfo', auth, bcryptPassword, changePassword)

module.exports = router